In [1]:
%matplotlib inline
from functions import loadDatasets, temporalRebins, commonLatLonGrid, spatialRegrids
from functions import computeMetrics, contourPlot, mymap
# def mymap(f, s): return map(f, s) # sequential single-core map function
In [2]:
path1 = "/Users/bdwilson/Documents/code/RCMES/Workshop/AFRICA_UC-WRF311_CTL_ERAINT_MM_50km-rg_1989-2008_tasmax.nc"
variable1 = "tasmax"
path2 = "/Users/bdwilson/Documents/code/RCMES/Workshop/AFRICA_KNMI-RACMO2.2b_CTL_ERAINT_MM_50km_1989-2008_tasmax.nc"
variable2 = "tasmax"
datasets = loadDatasets([(path1, variable1), (path2, variable2)], dir='./')
print datasets
In [ ]:
import ocw.dataset_processor as dsp
from datetime import timedelta
timeRes=timedelta(days=365)
datasets = temporalRebins(datasets, timeRes)
In [ ]:
latRes = 1.0 # degrees
lonRes = 1.0 # degrees
lats, lons = commonLatLonGrid(datasets, latRes, lonRes)
# Find common spatial bounds, return desired grid with specified resolution
datasets = spatialRegrids(datasets, lats, lons)
In [ ]:
metricNames = ['Bias']
results = computeMetrics(datasets, metricNames, subregions=None)
bias = results[0][0]
In [ ]:
outputName = "wrf_bias_compared_to_knm"
config = {'gridshape': (4, 5),
'ptitle': 'TASMAX Bias of WRF Compared to KNMI (1989 - 2008)',
'subtitles': range(1989, 2009, 1)
}
plotFile = contourPlot(bias, lats, lons, outputName, **config)
In [ ]:
from IPython.display import Image, display
display(Image(plotFile))
In [ ]: